package com.sctvcloud.qingchuan.ui.adapter.holder;

import android.content.Context;
import android.view.View;

import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.sctvcloud.qingchuan.R;
import com.sctvcloud.qingchuan.beans.PoliticsReplyDotBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 用户追问、融媒号回复
 */
public class PoliticsUserReplyHolder extends BaseAbsHolder<PoliticsReplyDotBean>  {
    @BindView(R.id.reply_tip)
    protected CustomFontTextView reply_tip;

    @BindView(R.id.reply_content)
    protected CustomFontTextView reply_content;

    private OnReplyClickListener replyClickListener;
    private PoliticsReplyDotBean temp;


    public PoliticsUserReplyHolder(Context context, View itemView, OnReplyClickListener replyClickListener) {
        super(context, itemView);
        this.replyClickListener = replyClickListener;
    }


    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(PoliticsReplyDotBean t) {
        temp = t;
        if (t.getType() == 1) {
            reply_tip.setText("追问：");
//            reply_content.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    if (null != replyClickListener) {
//                        replyClickListener.OnReplyClick(temp);
//                    }
//                }
//            });
        } else {
            reply_tip.setText("回复：");
            reply_content.setOnClickListener(null);
        }
        reply_content.setText(t.getContent());


    }

    @Override
    public void setItemMode(int mode) {
        super.setItemMode(mode);
//        if (mode == ITEMMODE_LAST) {
//            bottomLine.setVisibility(View.GONE);
//        } else {
////            bottomLine.setVisibility(View.VISIBLE);
//        }
    }

    @Override
    public void onDestory() {
        super.onDestory();
        if (itemView != null) {
            itemView.setOnClickListener(null);
        }
    }

    public interface OnReplyClickListener {
        void OnReplyClick(PoliticsReplyDotBean t);
    }
}
